﻿using System;
using System.Collections.Generic;
using System.Drawing;

using RRRSRoguelike.Helpers;
using RRRSRoguelike.Helpers.Visualizer;
using RRRSRoguelike.Managers;

namespace RRRSRoguelike.Screens
{
	/// <summary>
	/// Manages the UI to enter Random Seed Number to start.
	/// </summary>
	class LanguageScreen : Screen
	{
		Menu menu;
		List<long> timing = new List<long>();

		public LanguageScreen()
		{
			PanelList.Add(new MenuPanel(new Point(4, 3),
				Visualizer.GetScreenWidth() - 9, Visualizer.GetScreenHeight() - 6));

			menu = ((MenuPanel)PanelList[0]).Menu;
			
			SetupMenu();

		}

		#region Methods

		public override void Show()
		{
			Draw();
			while (active)
			{
				if (menu.HandleInput())
					menu.DrawMenu();
			}
			ApplicationManager.Instance.ScreenStack.Push(new OptionsScreen());
		}

		void Draw()
		{
			Clear();
			PanelList[0].Draw();
			menu.DrawMenu();
		}

		void SetupMenu()
		{
			menu.Add(new MenuItem(Properties.Strings.English, new EventHandler(SelectUS)));
			//FIXME: text here
			menu.Add(new MenuItem(Properties.Strings.French + (" - needs translation."), new EventHandler(SelectFR)));
			menu.Add(new MenuItem(Properties.Strings.Polish + (" - thanks to virt"), new EventHandler(SelectPL)));
			menu.Add(new MenuItem(Properties.Strings.Exit, new EventHandler(SelectExit)));

		}
		#endregion
		
		#region delegates
		//Event method
		void SelectUS(object sender, EventArgs e)
		{
			Language.NewLanguage("en-US");
			active = false;
		}

		//Event method
		void SelectFR(object sender, EventArgs e)
		{
			Language.NewLanguage("fr-FR");
			active = false;
		}

		void SelectPL(object sender, EventArgs e)
		{
			Language.NewLanguage("pl-PL");
			active = false;
		}

		void SelectExit(object sender, EventArgs e)
		{
			active = false;
		}




		#endregion
	}
}
